<template>
  <!-- :close-on-click-modal="false" //禁用点击空白区域
  :close-on-press-escape="false" //禁用ESC键 -->
  <el-dialog
    title="课题详情"
    :close-on-press-escape="false" 
    :close-on-click-modal="false"
    :append-to-body="true"
    :lock-scroll="true"
    :visible.sync="visible">


    <el-form  
    label-position="right"  label-width="80px"
    status-icon

    size="small"
    :model="dataForm"  ref="dataForm">
      <el-form-item label="课题名称" prop="cgyName">
        <!-- <el-input v-model="dataForm.cgyName" placeholder="课题名称"></el-input> -->
        <span>
          {{ dataForm.cgyName }}
        </span>
        
      </el-form-item>
      <el-form-item label="教师账号" prop="cgyDepart">
        <span>
          {{ dataForm.cgyDepart }}
        </span>
        
        <!-- <el-input v-model="dataForm.cgyDepart" placeholder="教师账号"></el-input> -->
      </el-form-item>
      <el-form-item label="类型" prop="cgyType">
        {{ dataForm.cgyType}}
        <!-- <el-input v-model="dataForm.cgyType"  placeholder="密码"></el-input> -->
      </el-form-item>
      <el-form-item label="课题来源" prop="cgySource">
        {{ dataForm.cgyName == 0 ? '学生' : '教师' }}
        <!-- <el-input v-model="dataForm.cgySource" placeholder="确认密码"></el-input> -->
      </el-form-item>
      <el-form-item label="教师账号" prop="tusername">
        {{ dataForm.tusername }}
        <!-- <el-input v-model="dataForm.tusername" placeholder="邮箱"></el-input> -->
      </el-form-item>
      <el-form-item label="教师姓名" prop="teaName">
        {{ dataForm.teaName }}
        <!-- <el-input v-model="dataForm.teaName" placeholder="手机号"></el-input> -->
      </el-form-item>
      
      <el-form-item label="指导意见" prop="cgyAdvise" size="mini">
        {{ dataForm.cgyAdvise }}
        <!-- <el-input v-model="dataForm.cgyAdvise" placeholder="院系"></el-input> -->
      </el-form-item>
      <el-form-item label="提交时间" prop="gmtCreate" size="mini">
        {{ dataForm.gmtCreate }}
        <!-- <el-input v-model="dataForm.gmtCreate" placeholder="职称"></el-input> -->
      </el-form-item>
      <el-form-item label="修改时间" prop="gmtModified">
        {{ dataForm.gmtModified }}
        <!-- <el-input v-model="dataForm.gmtModified" placeholder="职称"></el-input> -->
      </el-form-item>
      <el-form-item label="描述" prop="describes" size="mini">
        {{ dataForm.describes }}
        <!-- <el-input v-model="dataForm.describes" placeholder="学历"></el-input> -->
      </el-form-item>
    </el-form>

    <span slot="footer" class="dialog-footer">
      <el-button type="primary" @click="visible = false">返回</el-button>
    </span>
  </el-dialog>
</template>

<script>
import servicesApi from '@/services/servicesApi';
export default {
  data() {
    return {
      visible: false,
      dataForm: {
        cgyId: 1,
        userId: 37,
        cgyName: '大风打更人',
        cgyDepart: '计算机科学学院',
        cgyType: '毕业论文',
        cgySource: 1,
        tusername: 'admin',
        teaName: 'ldq',
        describes: 'string',
        cgyStatus: 1,
        cgyLeadstatus: 1,
        cgyAdvise: '',
        gmtCreate: '2022-11-07 20:49:30',
        gmtModified: '2022-11-07 20:49:30',
        version: 1,
        deleted: 0,
      },

    }
  },
  methods: {
    init(cgyId) {
      // console.log(cgyId)
      this.dataForm.cgyId = cgyId
      this.visible = true
      // 当数据被修改后使用这个方法，会回调获取更新后的dom再渲染出来
      // this.$nextTick(() => {
      //   this.$refs['dataForm'].resetFields()
      // })
      // servicesApi.getFlagList().then(res => {
      //   if (res.data.code === 200) {
      //     this.stateList = res.data.data //获取身份列表：学生、教师、管理员
      //     this.visible = true
      //     this.$nextTick(() => {
      //       this.$refs['dataForm'].resetFields()
      //     })
      //   }
      // })

      servicesApi.getTopicInfo(this.dataForm.cgyId).then(res => {
        let code = res.data.code
        let data = res.data.data
        // console.log('查询课题信息')
        if (code === 200) {
          // console.log(data)
          this.dataForm = data
        }
      })  
    },
  }
}
</script>
<style scoped>
.el-form-item{
  font-size: larger;
  
}
.span{
  color: blueviolet;
}
</style>
